package PTA.javaB;

import java.util.*;

public class ex22 {
    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);
        Set<String> str = new HashSet<>();
        int count=0;
while(true){
    String line = sc.next();
if(line.equals("!!!!!")){
    break;
}
str.add(line.toLowerCase());
}

        System.out.println(str.size()-2);




    }
}
